import request from '@/utils/request'

// 查询房源列表
export function listRooms(query) {
  return request({
    url: '/credit/business/room/available',
    method: 'get',
    params: query
  })
}

// 查询酒店列表
export function listHotels(query) {
  return request({
    url: '/credit/business/hotel/available',
    method: 'get',
    params: query
  })
}

// 查询商品列表
export function listGoods(query) {
  return request({
    url: '/credit/business/goods/available',
    method: 'get',
    params: query
  })
}

// 获取商品推荐
export function getGoodsRecommend(query) {
  return request({
    url: '/credit/business/goods/recommended',
    method: 'get',
    params: query
  })
}

// 获取房源详情
export function getRoomDetail(roomId) {
  return request({
    url: `/credit/business/room/detail/${roomId}`,
    method: 'get'
  })
}

// 获取酒店详情
export function getHotelDetail(hotelId) {
  return request({
    url: `/credit/business/hotel/detail/${hotelId}`,
    method: 'get'
  })
}

// 获取商品详情
export function getGoodsDetail(goodsId) {
  return request({
    url: `/credit/business/goods/detail/${goodsId}`,
    method: 'get'
  })
}

// 租赁房源
export function rentRoom(data) {
  return request({
    url: '/credit/businessService/rentRoomOpen',
    method: 'post',
    data: data
  })
}

// 预订酒店
export function bookHotel(data) {
  return request({
    url: '/credit/businessService/bookHotelOpen',
    method: 'post',
    data: data
  })
}

// 购买商品
export function buyGoods(data) {
  return request({
    url: '/credit/businessService/buyGoodsOpen',
    method: 'post',
    data: data
  })
}

// 获取用户信用分
export function getUserScore() {
  return request({
    url: '/credit/businessService/userCreditOpen',
    method: 'get'
  })
} 